//
//  JBWCommonParameterManager.m
//  JBWDSK
//
//  Created by 崔志伟 on 2018/7/30.
//  Copyright © 2018年 崔志伟. All rights reserved.
//

#import "JBWCommonParameterManager.h"
#import "JBWMD5Encrypt.h"
#import "JBWDeviceInfoManager.h"
#import "JBWDeviceDataLibrery.h"
#import "JBWNetWorkInfoManager.h"

@implementation JBWCommonParameterManager
+(instancetype )sharedInstance{
    
    static JBWCommonParameterManager *parameterManager = nil;
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        parameterManager = [[JBWCommonParameterManager alloc]init];
    });
    return parameterManager;
}
- (instancetype)init
{
    self = [super init];
    if (self) {
        self.commonParameter = [[NSMutableDictionary alloc]init];
        //设备号
        [self.commonParameter setObject:[[JBWDeviceInfoManager sharedManager]getDeviceName] forKey:@"DeviceNo"];
        
       //请求时间戳
        NSDate *date = [NSDate date];
        NSTimeInterval timeinterval = [date timeIntervalSince1970];
        [self.commonParameter setObject:[NSString stringWithFormat:@"%.0lf",timeinterval] forKey:@"Times"];

        //设备型号
         [self.commonParameter setObject:[[JBWDeviceInfoManager sharedManager]getDeviceModel] forKey:@"DeviceModel"];
        
        //IP
        [self.commonParameter setObject:[[JBWNetWorkInfoManager sharedManager]getDeviceIPAddresses] forKey:@"Ip"];
    }
    return self;
}
- (void)setAPPkey:(NSString *)APPkey{
    _APPkey = APPkey;
    //MD5加密后的APPkey
    [self.commonParameter setObject:[JBWMD5Encrypt MD5ForLower32Bate:_APPkey] forKey:@"key"];
}
- (void)setSDKVersion:(NSString *)SDKVersion{
    _SDKVersion = SDKVersion;
    //设备型号
    [self.commonParameter setObject:_SDKVersion forKey:@"SDKVersion"];
    
}
@end
